package com.example.pkmedical.Fragments;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.pkmedical.Activity.rollovershock.RolloverShockCantStartActivity;
import com.example.pkmedical.Activity.rollovershock.RolloverShockNextActivity;
import com.example.pkmedical.Base.BaseActivity;
import com.example.pkmedical.Event.MessageWrap;
import com.example.pkmedical.R;
import com.example.pkmedical.Utils.CommandUtil;
import com.example.pkmedical.Utils.EventBusUtils;
import com.example.pkmedical.Utils.SerialProtUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class NeedResumeActivity extends BaseActivity {

    @BindView(R.id.needresume_ok)
    Button needresumeOk;
    @BindView(R.id.needresume_cancle)
    Button needresumeCancle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_needresume);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {

    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void showDialog(String... msg) {

    }

    @OnClick({R.id.needresume_ok, R.id.needresume_cancle})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.needresume_ok:
                if (CommandUtil.RALL_ONE && CommandUtil.RALL_TWO && CommandUtil.RALL_THREE && CommandUtil.RALL_FOUR && CommandUtil.BED_FRONT < 40 && CommandUtil.BED_AFTER < 25) {
                    Intent intent = new Intent(this, RolloverShockNextActivity.class);
                    intent.putExtra("rollovershock_type", CommandUtil.TYPR_QJCF);
                    startActivity(intent);
                    CommandUtil.IS_ROLLOVEW_SHOCK = true;
                    EventBusUtils.post(MessageWrap.getInstance(MessageWrap.STOP_TIMER, 0));
                    NeedResumeActivity.this.finish();
                } else {
                    startActivity(new Intent(this, RolloverShockCantStartActivity.class));
                }
                break;
            case R.id.needresume_cancle:
                CommandUtil.IS_ROLLOVEW_SHOCK = false;
                SerialProtUtil.getInstance().sendBytes200(2, CommandUtil.CEFAN_STOP);
                SerialProtUtil.getInstance().sendBytes300(2, CommandUtil.CHANGGUI_TTYPE);
                NeedResumeActivity.this.finish();
                break;
        }
    }
}
